package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Great;
import cn.wolfcode.trip.base.domain.Region;
import cn.wolfcode.trip.base.mapper.GreatMapper;
import cn.wolfcode.trip.base.mapper.RegionMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.query.RegionQueryObject;
import cn.wolfcode.trip.base.service.IGreatService;
import cn.wolfcode.trip.base.service.IRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.swing.*;
import java.util.Date;
import java.util.List;

@Service
public class GreatServiceImpl implements IGreatService {
   @Autowired
    private GreatMapper greatMapper;

    @Override
    public Great get(Long userId, Long trevelId) {
        return greatMapper.selectByUserIdAndTreaveId(userId,trevelId);
    }

    @Override
    public void deleteGreat(Long userId, Long trevelId) {
        greatMapper.deleteGreat(userId,trevelId);
    }

    @Override
    public void insertGreat(Great great) {
        //点赞的时间
        great.setGreatTime(new Date());
        greatMapper.insert(great);
    }

    @Override
    public void updateState(Long authorId, int read) {
        greatMapper.updateState(authorId,read);
    }

    @Override
    public void updateCommentState(Long authorId, int read) {
        greatMapper.updateCommentState(authorId,read);
    }
}
